package com.ldx.springaopdemo.respect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Aspect
@Slf4j
@Component
public class MyAspectDemo {
    @Before("@annotation(com.ldx.springaopdemo.aspect.MyAspect)")
    public void doBefore(){
        log.info("do before");
    }
    @Around("@annotation(com.ldx.springaopdemo.aspect.MyAspect)")
    public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
        log.info("do around qian");
        Object result = joinPoint.proceed();
        log.info("do around hou");
        return result;
    }
}
